﻿@model ApplicationViewModel
@section ArtifactTitle {<span style="font-weight: normal;">Application:</span> @Model.CurrentApplication.Name
}
@{
    ViewBag.Title = "Index";
    ViewBag.CurrentMenuItem = Model.CurrentApplication.Name;
    this.AddToViewBag(Model);
}
@if (!string.IsNullOrEmpty(Model.Application.Description))
{
    <p class="description">@Model.Application.Description</p>
}
@if (Model.Application.ReceivePorts.Count > 0)
{
    <h2>
        Receive ports</h2>
    
    foreach (var receivePort in Model.Application.ReceivePorts.Values)
    { 
    <div class="section">
        <a href="@receivePort.Path(Model.CurrentManifest)">@receivePort.Name</a>
        @receivePort.ShortDescription()
    </div>
    }

}
@if (Model.Application.SendPorts.Count > 0)
{
    <h2>
        Send ports</h2>
    foreach (var sendPort in Model.Application.SendPorts.Values)
    {
    <div class="section">
        <a href="@sendPort.Path(Model.CurrentManifest)">@sendPort.Name</a>
        @sendPort.ShortDescription()
    </div>
    }
}
@if (Model.Application.Orchestrations.Count > 0)
{
    <h2>
        Orchestrations</h2>
    
    foreach (var orchestration in Model.Application.Orchestrations.Values)
    {
    <div class="section">
        <a href="@orchestration.Path(Model.CurrentManifest)">@orchestration.Name</a>
        @orchestration.ShortDescription()
    </div>
    }


}
@if (Model.Application.Maps.Count > 0)
{
    <h2>
        Maps</h2>
    foreach (var transform in Model.Application.Maps.Values)
    { 
    <div class="section">
        <a href="@transform.Path(Model.CurrentManifest)">@transform.Name</a>
        @transform.ShortDescription()
    </div>
    }
}
@if (Model.Application.Schemas.Count > 0)
{
    <h2>
        Schemas</h2>
    foreach (var schema in Model.Application.Schemas.Values)
    { 
    <div class="section">
        <a href="@schema.Path(Model.CurrentManifest)">@schema.Name - @schema.RootName</a> 
        @schema.ShortDescription()
    </div>
    }
}
@if (Model.Application.Pipelines.Count > 0)
{
    <h2>
        Pipelines</h2>
    foreach (var pipeline in Model.Application.Pipelines.Values)
    { 
    <div class="section">
        <a href="@pipeline.Path(Model.CurrentManifest)">@pipeline.Name</a>
        @pipeline.ShortDescription()
    </div>
    }
}
@if (Model.Application.Assemblies.Count > 0)
{
    <h2>
        Assemblies</h2>
    foreach (var assembly in Model.Application.Assemblies.Values)
    {
    <div class="section">
        <a href="@assembly.Path(Model.CurrentManifest)">@assembly.Name</a>
        @assembly.ShortDescription()
    </div>
    }
}
@if (Model.Application.ReferencedApplications.Count > 0)
{
    <h2>
        Referenced applications</h2>
    foreach (var application in Model.Application.ReferencedApplications)
    {
    <div class="section">
        <a href="@application.Path(Model.CurrentManifest)">@application.Name</a>
        @application.ShortDescription()
    </div>
    }
}
@section ManifestList {
    @Html.Partial("_ManifestListControl", new ManifestListModel()
{
    Manifests =
        Model.Manifests,
        CurrentManifest = Model.CurrentManifest,
    Artefact = Model.Application
})
}
